package com.jackie.easyble.ui.activities.connect.single

import android.bluetooth.le.ScanResult
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.sscl.easyble.enums.bleconnect.BleConnectPhyMask
import com.sscl.easyble.enums.bleconnect.BleConnectTransport

class SingleConnectActivityViewModel:ViewModel() {


    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     *
     * object声明
     *
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

    object SingleConnectActivityViewModelFactory : ViewModelProvider.Factory {
        /**
         * Creates a new instance of the given `Class`.
         *
         *
         *
         * @param modelClass a `Class` whose instance is requested
         * @param <T>        The type parameter for the ViewModel.
         * @return a newly created ViewModel
        </T> */
        override fun <T : ViewModel> create(modelClass: Class<T>): T {
            @Suppress("UNCHECKED_CAST")
            return SingleConnectActivityViewModel() as T
        }
    }

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     *
     * 属性声明
     *
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

    /**
     * 扫描的设备信息
     */
    val scanResult = MutableLiveData<ScanResult>()

    /**
     * 按钮的文字
     */
    val buttonText = MutableLiveData<String>()

    /**
     * 连接参数-是否自动重连
     */
    val autoReconnect = MutableLiveData<Boolean>()

    /**
     * 连接参数-指定GATT传输层
     */
    val bleConnectTransport = MutableLiveData<BleConnectTransport>()

    /**
     * 连接参数-GATT传输层名称
     */
    val bleConnectTransportName = MutableLiveData<String>()

    /**
     * 连接参数-GATT物理层
     */
    val bleConnectPhyMask = MutableLiveData<BleConnectPhyMask>()

    /**
     * 连接参数-GATT物理层名称
     */
    val bleConnectPhyMaskName = MutableLiveData<String>()
}